#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

void change(int *a, int *b)
{
	int temp = *a;
	*a = *b;
	*b = temp;
	
}

int main()
{
	int arr1[5];
	int* p1 = arr1;
	for (int i = 0; i < 5; i++)
	{
		scanf("%d", &arr1[i]);
	}

	int arr2[5];
	int* p2 = arr2;
	for (int i = 0; i < 5; i++)
	{
		scanf("%d", p2 + i);
	}

	for (int i = 0; i < 5; i++)
	{
		change((p1 + i), (p2 + i));
	}

	for (int i = 0; i < 5; i++)
	{
		printf("%d ", p1[i]);
	}

	printf("\n");

	for (int i = 0; i < 5; i++)
	{
		printf("%d ", p2[i]);
	}


	return 0;
}